MAPS

Where do surfers travel?

Connection Map

Photo by Josh Withers on Unsplash

Photo by Josh Withers on Unsplash

I’m surfing the giant life wave….
— William Shatner


Ingest

tweets and lights

# Load data
df <- read.csv("archetypes/where-do-surfers-travel/where-do-surfers-travel.csv", header = TRUE, stringsAsFactors = FALSE)
df
# use city populations to simulate lights as in original
lights = read.csv("archetypes/cities-top-10000-world.csv", header = TRUE, stringsAsFactors = FALSE)
# lights

Wrangler

column as factor

Categorizing homecontinent column as a factor. The Continents levels will be used to color the lines on the map.

# factor for color scale
df$homecontinent=factor(df$homecontinent, levels=c("Asia", "Europe", "Australia", "Africa", "North America", "South America", "Antarctica"))
df

Base map

natural earth

# PLOT NATURAL EARTH BORDERS
ne_world <- ne_countries(scale = "small", returnclass = "sf")

Map Theme

dark

theme_opts <- theme(
      legend.position="bottom",
      legend.title = element_blank(),
      panel.grid.major = element_blank(),
      panel.grid.minor = element_blank(),
      panel.border = element_blank()
)

theme_dark <- theme(
  panel.background=element_rect(fill="#05050f", colour="#000000"),
)

Connection Map

with geom_line

v1 <- ggplot(data = ne_world) +
  # map feature styling to match blue marble dark lights
  geom_sf(fill="#211f3c", color="#131522", stroke=0.5) +
  # lights
  geom_point( data = lights, aes(x=lng, y=lat, alpha=Population), size=0.5, color="#f9e6ba" ) +
  # brightness by population
  scale_alpha_continuous(range=c(0.1,1), guide=FALSE) +
  # connections
  geom_line(data=df, aes(x=lon, y=lat, group=group, colour=homecontinent, alpha=n), size=0.6) +
  # guides(alpha = "none") +
  scale_color_brewer(palette="Set3") +
  theme_bw() +
  labs(x="",
       y="",
       title = "Where surfers travel", 
       subtitle="10,000 #surf tweets recovered") +
  theme_opts +
  theme_dark

girafe(ggobj = v1, width_svg = 16, height_svg = 9,
       options = list(opts_sizing(rescale = TRUE, width = 1.0)))

References

citations for narrative and data sources

  • Narrative and Data source: GO